<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>建议</title>
    <link rel="stylesheet" href="../public/dist/css/layui.css">
    <link rel="stylesheet" href="../public/dist/css/swiper.min.css">
    <link rel="stylesheet" href="../css/advice.css">
</head>

<body>
    <p class="jianyi">投诉建议</p>
    <div class="tou">
        <div>
            <label>标题</label>
            <input type="text" placeholder="标题" class="biao">
        </div>
        <div>
            <label>内容</label>
            <textarea placeholder="内容" class="nei"></textarea>
        </div>
        <div>
            <label>身份证号码</label>
            <input type="text" placeholder="身份证号码" class="shen" maxlength="18">
        </div>
        <div>
            <label>姓名</label>
            <input type="text" placeholder="姓名" class="ming">
        </div>
        <div class="tijiaos">
            <div class="layui-btn" id="jdjsdsa">提交</div>
            <div class="layui-btn" id="quxiao">取消</div>
        </div>
    </div>
</body>
<script src="../js/jquery.min.js"></script>
<script src="../public/dist/layui.js"></script>
<script src="../public/dist/js/swiper.min.js"></script>
<script src='../js/api.js'></script>

<script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use(['form', 'element', "layer"], function() {
        var element = layui.element,
            form = layui.form,
            $ = layui.$,
            layer = layui.layer,
            carousel = layui.carousel;

        $("#jdjsdsa").click(function() {
            if ($(".biao").val() == "") {
                layer.msg("请输入标题")
                return
            }

            if ($(".nei").val() == "") {
                layer.msg("请输入内容")
                return
            }

            if ($(".shen").val() == "") {
                layer.msg("请输入身份证")
                return
            }

            if ($(".ming").val() == "") {
                layer.msg("请输入名字")
                return
            }

            var ddd = new Date()

            var obj = {
                title: $(".biao").val(),
                content: $(".nei").val(),
                createDate: ddd,
                status: 1,
                idCard: $(".shen").val(),
                name: $(".ming").val()
            }

            $.post("http://47.98.167.96:9527/gzaqzs/saveComplaintAdvice", obj, function(result) {

                if (result.code === 200) {
                    layer.msg("提交成功", {
                        icon: 1,
                        time: 800
                    })
                } else {
                    layer.msg("提交失败", {
                        icon: 5,
                        time: 600
                    })
                }

                window.location.href = "../index.html";
            });

        })


        $("#quxiao").click(function() {
            window.location.href = "../index.html";
        })


    })
</script>